﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RMS.Utils.MVP;
using RMS.Web.Shell.View;
using RMS.DataAccess.Entities;
using RMS.DataAccess.Repositories;
using RMS.Utils.Authentication;

namespace RMS.Web.Shell.Presenter
{
    public class PatientPresenter : Presenter<IPatientView>
    {
        PatientsRepository _patientsRepository;
        IAuthentication _iAuthentication;
        ContractsRepository _contractsRepository;
        public PatientPresenter(PatientsRepository patientsRepository, ContractsRepository contractsRepository, IAuthentication iAuthentication)
        {
            _patientsRepository = patientsRepository;
            _iAuthentication = iAuthentication;
            _contractsRepository = contractsRepository;
        }

        public Patients GetPatient(int Id)
        {
            return _patientsRepository.Find(item => { item.PatientID = Id; }).Single(); ;
        }
        public int insertPatients(Patients patient)
        {
            return _patientsRepository.Insert(patient);
        }
        public bool UpdatePatient(Patients patient)
        {
            _patientsRepository.Update(patient);
            return true;
        }
        public IEnumerable<Contracts> GetContracts()
        {
            return _contractsRepository.FindAll();
        }
    }
}
